﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Plato
{
    class Method
    {
        private static decimal[] Multiples 
        {
            get
            {
                return new decimal[] { 0.00000001m, 0.0000001m, 0.000001m, 0.00001m, 0.0001m, 0.001m, 0.01m, 0.1m, 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000 };
            }
        }

        public static int GetMaxValue(int[] Items)
        {
            int o;
            o = Items[0];
            for (int i = 1; i < Items.Length; i++)
            {
                if (Items[i] > o)
                {
                    o = Items[i];
                }
            }
            return o;
        }
        public static decimal GetMaxValue(decimal[] Items)
        {
            decimal mMaxValue;
            mMaxValue = Items[0];
            for (int i = 1; i < Items.Length; i++)
            {
                if (Items[i] > mMaxValue)
                {
                    mMaxValue = Items[i];
                }
            }
            return mMaxValue;
        }


        public static decimal GetMultiples(decimal value)
        {
            int index = 0;

            for (int i = 0; i < Multiples.Length; i++)
            {
                decimal f = Multiples[i] * value;
                if (f <= 10 && f >= 1)
                {
                    index = i;
                    break;
                }
            }
            return Multiples[index];
        }
    }
}
